package com.java.system.common.entity.admin;

import com.java.system.common.validatedGroup.Add;
import com.java.system.common.validatedGroup.Modify;
/*import com.joyoung.cloud.security.common.validatedGroup.Add;
import com.joyoung.cloud.security.common.validatedGroup.Modify;*/
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;
/*import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;*/
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.Id;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;

/**
 * 角色(SysRole)实体类
 *
 * @author makejava
 * @since 2019-05-31 10:41:06
 */
@ApiModel(value = "角色类")
@Data
@Accessors(chain = true)
public class SysRole implements Serializable {
    private static final long serialVersionUID = -22675307421816027L;
    //id
    @ApiModelProperty(value = "主键ID")
    @Id
    @Null(message = "{add_id}", groups = {Add.class})
    @NotNull(message = "{modify_id}", groups = {Modify.class})
    private String id;
    @ApiModelProperty(value = "父ID")
    private String parentId;
    //名称
    @ApiModelProperty(value = "角色名")
    @NotBlank(message = "{name_null}")
    @Pattern(regexp = "^[\\s\\S]{1,20}$",message = "{name_rule}")
    private String name;
    //英文名称
    @ApiModelProperty(value = "角色英文名")
    @Pattern(regexp = "^$|[a-zA-Z\\s]{1,30}$", message = "{enname_rule}")
    private String enName;
    //所属公司
    @ApiModelProperty(value = "所属公司id")
    private String companyId;
    //角色类型：global = 全局， public = 公共，private = 私有 
    // 解释：global：只要用户正常登录系统后则默认就拥有该类角色，该类角色各租户只有使用权，无编辑权
    // public：此类角色只允许多租户使用，不允许编辑
    // private：此类角色是租户自己维护的角色，租户拥有全部的使用权和维护权
    @ApiModelProperty(value = "角色类型")
    @NotBlank(message = "{roletype_null}")
    private String roleType;
    //是否允许分配：是否允许将刚该权限通过普通用户进行再次分配  0 = 否， 1 = 是
    @ApiModelProperty(value = "是否允许分配")
    private Object isAllocation;
    //是否禁用：0 = 否，1 = 是
    @ApiModelProperty(value = "是否禁用")
    @NotNull(message = "角色状态不能为空")
    private Integer isDisable;
    //创建时间
    @ApiModelProperty(value = "创建时间")
    private Date crtTime;
    //创建人id
    @ApiModelProperty(value = "创建人ID")
    private String crtUser;
    //创建人名称
    @ApiModelProperty(value = "创建人名称")
    private String crtName;
    //创建人IP
    @ApiModelProperty(value = "创建人IP")
    private String crtHost;
    //修改时间
    @ApiModelProperty(value = "修改时间")
    private Date updTime;
    //修改人id
    @ApiModelProperty(value = "修改人ID")
    private String updUser;
    //修改人名称
    @ApiModelProperty(value = "修改人名称")
    private String updName;
    //修改人IP
    @ApiModelProperty(value = "修改人IP")
    private String updHost;
    //删除标识:0=否，1 = 是
    @ApiModelProperty(value = "删除标识")
    private int delFlag;
    @Transient
    private String companyName;
    //预留字段
    private String attr3;
    //预留字段
    private String attr2;
    //预留字段
    private String attr1;
    @Transient
    private Boolean hasChecked;
    @Transient
    private Boolean hasChildren;//是否有子节点
    @Transient
    private List<SysRole> children = new LinkedList<SysRole>();

}